package cn.yunhe.interceptor;

import java.util.Date;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

import cn.yunhe.action.interceptorAction;

public class MyInterceptor extends AbstractInterceptor {
	private int sleep;
	public String intercept(ActionInvocation invocation) throws Exception {
		System.out.println("开始执行的当前时间为"+new Date().toLocaleString());
		interceptorAction iAction=(interceptorAction) invocation.getAction();
		iAction.setSleep(sleep);
		String result=invocation.invoke();
		System.out.println(result+"=result");
		System.out.println("现在执行时间是"+new Date().toLocaleString());
		return result;
	}
	public int getSleep() {
		return sleep;
	}
	public void setSleep(int sleep) {
		this.sleep = sleep;
	}

}
